#!/bin/sh

referenceHeader=`cat Header.txt`

totalFiles=0
incorrectFiles=0

for sourcePath in `find $1 -name *.cs -o -name *.h -o -name *.c -o -name *.cpp`
do
	totalFiles=`expr $totalFiles + 1`
	testHeader=`head -16 $sourcePath`
	if [ "$testHeader" != "$referenceHeader" ]
	then
		incorrectFiles=`expr $incorrectFiles + 1`
		echo "Incorrect header: ${sourcePath#../}"
	fi
done

echo "Files checked:     $totalFiles"
echo "Incorrect headers: $incorrectFiles"

if [ $incorrectFiles -gt 0 ]
then exit 1
fi
